package com.leetroll.app.controller;

import com.leetroll.api.service.IssueService;
import com.leetroll.api.service.OrderService;
import com.leetroll.api.service.impl.ItemServiceImpl;
import com.leetroll.app.utils.AppJwtTokenUtil;
import com.leetroll.common.bean.ApiResponse;
import com.leetroll.common.entity.Issue;
import com.leetroll.common.entity.Order;
import com.leetroll.common.enums.EOrderStatus;
import com.leetroll.common.vo.ItemVO;
import com.leetroll.common.vo.OrderVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("/issue")
@Api(value = "问题相关接口", tags = {"问题相关接口"})
@Slf4j
public class IssueController {

    private final IssueService issueService;

    @Autowired
    public IssueController(IssueService issueService) {
        this.issueService = issueService;
    }

    @ApiOperation(value = "查询用户点赞收藏的items", notes = "查询用户点赞收藏的items")
    @GetMapping("/list")
    public ApiResponse<List<Issue>> list(@RequestParam(name = "pageNumber", required = false, defaultValue = "1") Integer pageNumber,
                                         @RequestParam(name = "pageSize", required = false, defaultValue = "12") Integer pageSize,
                                         @RequestParam(name = "subject", required = false) String subject,
                                         @RequestParam(name = "keyword", required = false, defaultValue = "") String keyword
    ) {
        List<Issue> list = issueService.list(subject, keyword, pageNumber, pageSize);
        return ApiResponse.OK(list);
    }
}
